package Backtracking;
/*
 * 子集
 */
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class lc78 {

    List<List<Integer>> result = new ArrayList<>();
    LinkedList<Integer> path = new LinkedList<>();
    public List<List<Integer>> subsets(int[] nums) {
        if (nums.length == 0) return result;
        backtacking(nums, 0);
        return result;
    }
    public void backtacking(int[] nums, int start) {
        result.add(new ArrayList<>(path));
        for (int i = start; i < nums.length; i++) {
            path.add(nums[i]);
            backtacking(nums, i + 1);
            path.removeLast();
        }
    }

}
